﻿@using System.Diagnostics;
@using System.Collections;
@using System.Reflection;
@using System.Runtime.Versioning;
@using Microsoft.AspNetCore.Http
@using NewLife.Common;
@using NewLife.Serialization
@inject IHttpContextAccessor HttpContextAccessor
@{
    //Layout = NewLife.Cube.Setting.Current.Layout;

    var session = HttpContextAccessor.HttpContext.Session;
    var session2 = HttpContextAccessor.HttpContext.Items["Session"] as IDictionary<String, Object>;
    ViewBag.Title = "Session列表";
}

<div class="row d-flex align-items-lg-stretch">
    <div class="col-lg-6">
        <div class="card card-custom card-stretch gutter-b">
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-bordered table-hover table-condensed">
                        <tr>
                            <th class="text-dark text-hover-primary font-size-h5 font-weight-bold" colspan="6">
                                Session列表(@session.Keys.Count())
                            </th>
                        </tr>
                        <tr>
                            <th>名称</th>
                            <th>类型</th>
                            <th>数值</th>
                        </tr>
                        @foreach (String item in session.Keys)
                        {
                            <tr>
                                <td>@item</td>
                                <td></td>
                                <td>@session.GetString(item)</td>
                            </tr>
                        }
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="col-lg-6">
        @if (session2 != null)
        {
            <div class="card card-custom card-stretch gutter-b">
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover table-condensed">
                            <tr>
                                <th class="text-dark text-hover-primary font-size-h5 font-weight-bold" colspan="6">
                                    Session2列表(@session2.Count)
                                </th>
                            </tr>
                            <tr>
                                <th>名称</th>
                                <th>类型</th>
                                <th>数值</th>
                            </tr>
                            @foreach (var item in session2)
                            {
                                <tr>
                                    <td>@item.Key</td>
                                    <td>@item.Value?.GetType().FullName</td>
                                    <td>@item.Value</td>
                                </tr>
                            }
                        </table>
                    </div>
                </div>
            </div>
        }
    </div>
</div>

